from itsdangerous import TimedJSONWebSignatureSerializer as Serializer

from meiduo_mall_chen import settings
def generate_safe_openid(data):
    S = Serializer(secret_key=settings.SECRET_KEY,expires_in=60 * 60)
    data = {
        'data':data
    }
    safe_openid = S.dumps(data)
    return safe_openid
def load_true_openid(data):
    S = Serializer(secret_key=settings.SECRET_KEY,
                   expires_in=60 * 60)
    true_openid = S.loads(data)
    true_openid = true_openid.get('data')
    return true_openid
